package filepro.file;


import java.io.*;

/**
 * 字符流
 * @author small瑞
 */
public class ReaderWriter {
    public static void main(String[] args) throws IOException {
        String path = "G:\\IO\\山海经/南山开篇.txt";
        File file = new File(path);
        Reader fileReader = new FileReader(file);
        System.out.println(fileReader.ready());

        //根据对应的编码将int转义成字符
        Writer writer = new FileWriter("G:\\IO\\山海经/南山篇.txt");
        int cur ;
        while((cur=fileReader.read())!=-1){
            writer.write(cur);
        }

        writer.flush();
        writer.close();
        fileReader.close();
    }
}

